3.396 \(\int x \cos (2 x) \sec ^2(x) \, dx\)

Optimal. Leaf size=14 \[ x^2-x \tan (x)-\log (\cos (x)) \]

[Out]

x^2 - Log[Cos[x]] - x*Tan[x]

________________________________________________________________________________________

Rubi [A]  time = 0.0331439, antiderivative size = 14, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 10, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.4, Rules used = {4431, 3720, 3475, 30} \[ x^2-x \tan (x)-\log (\cos (x)) \]

Antiderivative was successfully verified.

[In]

Int[x*Cos[2*x]*Sec[x]^2,x]

[Out]

x^2 - Log[Cos[x]] - x*Tan[x]

Rule 4431

Int[((e_.) + (f_.)*(x_))^(m_.)*(F_)[(a_.) + (b_.)*(x_)]^(p_.)*(G_)[(c_.) + (d_.)*(x_)]^(q_.), x_Symbol] :> Int
[ExpandTrigExpand[(e + f*x)^m*G[c + d*x]^q, F, c + d*x, p, b/d, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && M
emberQ[{Sin, Cos}, F] && MemberQ[{Sec, Csc}, G] && IGtQ[p, 0] && IGtQ[q, 0] && EqQ[b*c - a*d, 0] && IGtQ[b/d,
1]

Rule 3720

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(c + d*x)^m*(b*Tan[e
 + f*x])^(n - 1))/(f*(n - 1)), x] + (-Dist[(b*d*m)/(f*(n - 1)), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rubi steps

\begin{align*} \int x \cos (2 x) \sec ^2(x) \, dx &=\int \left (x-x \tan ^2(x)\right ) \, dx\\ &=\frac{x^2}{2}-\int x \tan ^2(x) \, dx\\ &=\frac{x^2}{2}-x \tan (x)+\int x \, dx+\int \tan (x) \, dx\\ &=x^2-\log (\cos (x))-x \tan (x)\\ \end{align*}

Mathematica [A]  time = 0.0232502, size = 14, normalized size = 1. \[ x^2-x \tan (x)-\log (\cos (x)) \]

Antiderivative was successfully verified.

[In]

Integrate[x*Cos[2*x]*Sec[x]^2,x]

[Out]

x^2 - Log[Cos[x]] - x*Tan[x]

________________________________________________________________________________________

Maple [A]  time = 0.042, size = 15, normalized size = 1.1 \begin{align*}{x}^{2}-\ln \left ( \cos \left ( x \right ) \right ) -x\tan \left ( x \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*cos(2*x)*sec(x)^2,x)

[Out]

x^2-ln(cos(x))-x*tan(x)

________________________________________________________________________________________

Maxima [B]  time = 1.56808, size = 150, normalized size = 10.71 \begin{align*} \frac{2 \, x^{2} \cos \left (2 \, x\right )^{2} + 2 \, x^{2} \sin \left (2 \, x\right )^{2} + 4 \, x^{2} \cos \left (2 \, x\right ) + 2 \, x^{2} -{\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )} \log \left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right ) - 4 \, x \sin \left (2 \, x\right )}{2 \,{\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x)^2,x, algorithm="maxima")

[Out]

1/2*(2*x^2*cos(2*x)^2 + 2*x^2*sin(2*x)^2 + 4*x^2*cos(2*x) + 2*x^2 - (cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1)
*log(cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1) - 4*x*sin(2*x))/(cos(2*x)^2 + sin(2*x)^2 + 2*cos(2*x) + 1)

________________________________________________________________________________________

Fricas [A]  time = 0.486144, size = 73, normalized size = 5.21 \begin{align*} \frac{x^{2} \cos \left (x\right ) - \cos \left (x\right ) \log \left (-\cos \left (x\right )\right ) - x \sin \left (x\right )}{\cos \left (x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x)^2,x, algorithm="fricas")

[Out]

(x^2*cos(x) - cos(x)*log(-cos(x)) - x*sin(x))/cos(x)

________________________________________________________________________________________

Sympy [B]  time = 53.0657, size = 144, normalized size = 10.29 \begin{align*} x^{2} + \frac{2 x \tan{\left (\frac{x}{2} \right )}}{\tan ^{2}{\left (\frac{x}{2} \right )} - 1} - \frac{\log{\left (\tan{\left (\frac{x}{2} \right )} - 1 \right )} \tan ^{2}{\left (\frac{x}{2} \right )}}{\tan ^{2}{\left (\frac{x}{2} \right )} - 1} + \frac{\log{\left (\tan{\left (\frac{x}{2} \right )} - 1 \right )}}{\tan ^{2}{\left (\frac{x}{2} \right )} - 1} - \frac{\log{\left (\tan{\left (\frac{x}{2} \right )} + 1 \right )} \tan ^{2}{\left (\frac{x}{2} \right )}}{\tan ^{2}{\left (\frac{x}{2} \right )} - 1} + \frac{\log{\left (\tan{\left (\frac{x}{2} \right )} + 1 \right )}}{\tan ^{2}{\left (\frac{x}{2} \right )} - 1} + \frac{\log{\left (\tan ^{2}{\left (\frac{x}{2} \right )} + 1 \right )} \tan ^{2}{\left (\frac{x}{2} \right )}}{\tan ^{2}{\left (\frac{x}{2} \right )} - 1} - \frac{\log{\left (\tan ^{2}{\left (\frac{x}{2} \right )} + 1 \right )}}{\tan ^{2}{\left (\frac{x}{2} \right )} - 1} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x)**2,x)

[Out]

x**2 + 2*x*tan(x/2)/(tan(x/2)**2 - 1) - log(tan(x/2) - 1)*tan(x/2)**2/(tan(x/2)**2 - 1) + log(tan(x/2) - 1)/(t
an(x/2)**2 - 1) - log(tan(x/2) + 1)*tan(x/2)**2/(tan(x/2)**2 - 1) + log(tan(x/2) + 1)/(tan(x/2)**2 - 1) + log(
tan(x/2)**2 + 1)*tan(x/2)**2/(tan(x/2)**2 - 1) - log(tan(x/2)**2 + 1)/(tan(x/2)**2 - 1)

________________________________________________________________________________________

Giac [B]  time = 1.16055, size = 159, normalized size = 11.36 \begin{align*} \frac{2 \, x^{2} \tan \left (\frac{1}{2} \, x\right )^{2} - \log \left (\frac{4 \,{\left (\tan \left (\frac{1}{2} \, x\right )^{4} - 2 \, \tan \left (\frac{1}{2} \, x\right )^{2} + 1\right )}}{\tan \left (\frac{1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac{1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac{1}{2} \, x\right )^{2} - 2 \, x^{2} + 4 \, x \tan \left (\frac{1}{2} \, x\right ) + \log \left (\frac{4 \,{\left (\tan \left (\frac{1}{2} \, x\right )^{4} - 2 \, \tan \left (\frac{1}{2} \, x\right )^{2} + 1\right )}}{\tan \left (\frac{1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac{1}{2} \, x\right )^{2} + 1}\right )}{2 \,{\left (\tan \left (\frac{1}{2} \, x\right )^{2} - 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(2*x)*sec(x)^2,x, algorithm="giac")

[Out]

1/2*(2*x^2*tan(1/2*x)^2 - log(4*(tan(1/2*x)^4 - 2*tan(1/2*x)^2 + 1)/(tan(1/2*x)^4 + 2*tan(1/2*x)^2 + 1))*tan(1
/2*x)^2 - 2*x^2 + 4*x*tan(1/2*x) + log(4*(tan(1/2*x)^4 - 2*tan(1/2*x)^2 + 1)/(tan(1/2*x)^4 + 2*tan(1/2*x)^2 +
1)))/(tan(1/2*x)^2 - 1)